package j2se.StringBuilder;

/**
 * Created by Auto_Wd on 2015/3/11.
 * com.reesechou.j2se.StringBuilder
 */
public class Test {
    //stringBuffer是多线程的，比较安全，而stringBuilder是单线程的，比较效率
    //当我们动态添加字符串，末尾带一些没必要的字符时，可以使用deleteCharAt方法
    public static void main(String[] args){
        StringBuilder sBuild = new StringBuilder();
        sBuild.append("1,2,3,");
        if(sBuild!=null&&sBuild.length()>1){
            sBuild.deleteCharAt(sBuild.length()-1);
        }
        System.out.println(sBuild.toString());
    }
}
